//
//  ZDOrderLastCell.m
//  ZDPension
//
//  Created by 刘甲奇 on 2017/6/21.
//  Copyright © 2017年 maker. All rights reserved.
//

#import "ZDOrderLastCell.h"

@interface ZDOrderLastCell()

@property (weak, nonatomic) IBOutlet UILabel *goodsTotalLabel;
@property (weak, nonatomic) IBOutlet UIView *bottonView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buttonViewHeight;
@property (weak, nonatomic) IBOutlet UIButton *payButton;
@property (weak, nonatomic) IBOutlet UIButton *cancelButton;

/**
 <#Description#>
 */
@property(nonatomic, strong) orderClickBlock block;

@end

@implementation ZDOrderLastCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.payButton.layer.borderWidth = 1;
    self.payButton.layer.borderColor = LEHaxColor(0xc8c8c8).CGColor;
    self.cancelButton.layer.borderWidth = 1;
    self.cancelButton.layer.borderColor = LEHaxColor(0xc8c8c8).CGColor;}

- (void)setOrdemode:(OrderMode)ordemode
{
    switch (ordemode) {
        case WaitPay:
        {
            [self.cancelButton setTitle:@"取消订单" forState:0];
            [self.payButton setTitle:@"支付" forState:0];
        }
            break;
        case WaitConsume:
        {
            self.buttonViewHeight.constant = 0;
            self.bottonView.hidden = YES;
        }
            break;
        case WaitCommit:
        {
            [self.payButton setTitle:@"去评价" forState:0];
            self.cancelButton.hidden = YES;
        }
            break;
        case Finished:
        {
            self.buttonViewHeight.constant = 0;
            self.bottonView.hidden = YES;
        }
            break;
            
        default:
            break;
    }
}
- (void)setModel:(ZDOrderModel *)model
{
    _model = model;
    self.goodsTotalLabel.text = [NSString stringWithFormat:@"共计: %@",model.order_amount];
}
- (void)orderCellClick:(orderClickBlock)block
{
    _block = block;
}

/**
 取消订单传1,支付传2

 @param sender 
 */
- (IBAction)payClick:(UIButton *)sender
{
    ZDLog(@"%s---%d---支付",__func__,__LINE__);
    _block(2,_model);
}
- (IBAction)cancelClick:(UIButton *)sender
{
    ZDLog(@"%s---%d---取消",__func__,__LINE__);
    _block(1,_model);
}


@end
